#include<iostream>
using namespace std;
typedef long long LL;
const int N = 110;
int a[N], b[N];
int n, m;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n >> m;
		for (int i = 1; i <= n; i++) {
			cin >> a[i];
		}
		for (int i = 1; i <= m; i++) {
			cin >> b[i];
			int mi = 0x3f3f3f3f;
			for (int j = 1; j <= n; j++) {
				mi = min(mi, a[j]);
			}
			for (int j = 1; j <= n; j++) {
				if (a[j] == mi) {
					a[j] = b[i];
					break;
				}
			}
		}
		LL ans = 0;
		for (int i = 1; i <= n; i++) {
			ans += a[i];
		}
		cout << ans << endl;
	}
	return 0;
}